home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / system / sysprof3.zip / ORIGINAL.ARC / PROFCTRL.C next >
C/C++ Source or Header  |  1988-06-16  |  20KB  |  492 lines

  1. /*****************************************************************************/
  2. /*                                                                           */
  3. /*                                 Listing 2                                 */
  4. /*                                                                           */
  5. /*  NAME : PROFCTRL                                                          */
  6. /*                                                                           */
  7. /*  DATE : March 30, 1988                                                    */
  8. /*                                                                           */
  9. /*  AUTHOR : (C) Copyright 1988 G. Kent Cobb - All Rights Reserved           */
  10. /*                                                                           */
  11. /*  DESCRIPTION :                                                            */
  12. /*      This program provides control functions for the terminate-and-stay-  */
  13. /*      resident system profiler.  The syntax for executing PROFCTRL is:     */
  14. /*                                                                           */
  15. /*                                                                           */
  16. /*                          |   STATUS                     |                 */
  17. /*                          |     ON                       |                 */
  18. /*                 PROFCTRL |     OFF                      |                 */
  19. /*                          |    ZERO                      |                 */
  20. /*                          |   REPORT [output-file-name]  |                 */
  21. /*                                                                           */
  22. /*      The ON and OFF options affect the accumulation of interrupt data;    */
  23. /*      STATUS reports the current state; ZERO erases all data that has      */
  24. /*      been accumulated; and REPORT generates a listing that describes      */
  25. /*      the contents of the tables.                                          */
  26. /*                                                                           */
  27. /*      SYS_PROF and PROFCTRL are most easily used in a batch file, such as: */
  28. /*                                                                           */
  29. /*                                                                           */
  30. /*                            SYS_PROF                                       */
  31. /*                            PROFCTRL zero                                  */
  32. /*                            PROFCTRL on                                    */
  33. /*                            chkdsk c:                                      */
  34. /*                            PROFCTRL off                                   */
  35. /*                            PROFCTRL report temp                           */
  36. /*                            d:list temp                                    */
  37. /*                                                                           */
  38. /*****************************************************************************/
  39. #include "stdio.h"
  40. #include "dos.h"
  41.  
  42. #define NUM_INTS 9
  43. #define END_OF_STRING '\0'
  44.  
  45. #define CONTROL_INTERRUPT   96
  46. #define STATUS          0
  47. #define OFF             1
  48. #define ON              2
  49. #define FIND            3
  50. #define ZERO            4
  51. #define REPORT          5
  52.  
  53. #define DOS             0x21
  54. #define GET_INT_VECTOR  0x35
  55.  
  56. struct tally
  57.     {
  58.     long time;
  59.     long number;
  60.     };
  61.  
  62. long total_ticks;       /*  TOTAL NUMBER OF TIMER TICKS RECORDED.  */
  63.  
  64. char *int_desc[NUM_INTS+1] = {"OTHER",
  65.                               "PRINT SCREEN - INTERRUPT 5H",
  66.                               "VIDEO BIOS - INTERRUPT 10H",
  67.                               "DISK SERVICES - INTERRUPT 13H",
  68.                               "COMM PORT - INTERRUPT 14H",
  69.                               "KEYBOARD BIOS - INTERRUPT 16H",
  70.                               "PRINTER BIOS - INTERRUPT 17H",
  71.                               "DOS FUNCTIONS - INTERRUPT 21H",
  72.                               "DOS ABSOLUTE DISK READ - INTERRUPT 25H",
  73.                               "DOS ABSOLUTE DISK WRITE - INTERRUPT 26H" };
  74.  
  75. int max_services[NUM_INTS+1] = {0,0,20,24,4,3,3,99,0,0};
  76.  
  77. char *other_services[] = {""};
  78. char *print_screen_services[] = {""};
  79. char *video_services[] = {"00 - Set Mode",
  80.                           "01 - Set Cursor Size",
  81.                           "02 - Set Cursor Position",
  82.                           "03 - Get Cursor Position",
  83.                           "04 - Get Light Pen Position",
  84.                           "05 - Set Active Page",
  85.                           "06 - Scroll Up",
  86.                           "07 - Scroll Down",
  87.                           "08 - Read Character and Attribute",
  88.                           "09 - Write Character and Attribute",
  89.                           "0A - Write Character",
  90.                           "0B - Set Palette",
  91.                           "0C - Write Dot",
  92.                           "0D - Read Dot",
  93.                           "0E - Write TTY",
  94.                           "0F - Get Mode",
  95.                           "10 - Service 16",
  96.                           "11 - Service 17",
  97.                           "12 - Service 18",
  98.                           "13 - Write String",
  99.                           "Undefined services"};
  100. char *disk_services[] = {"00 - Reset Diskette System",
  101.                          "01 - Get Diskette Status",
  102.                          "02 - Read Sectors",
  103.                          "03 - Write Sectors",
  104.                          "04 - Verify Sectors",
  105.                          "05 - Format Track",
  106.                          "06 - Service 6",
  107.                          "07 - Service 7",
  108.                          "08 - Get Drive Parameters",
  109.                          "09 - Initialize Parameter Tables",
  110.                          "0A - Read Long",
  111.                          "0B - Write Long",
  112.                          "0C - Seek to Cylinder",
  113.                          "0D - Alternate Disk Reset",
  114.                          "0E - Service 14",
  115.                          "0F - Service 15",
  116.                          "10 - Test Ready",
  117.                          "11 - Recalibrate Drive",
  118.                          "12 - Service 18",
  119.                          "13 - Service 19",
  120.                          "14 - Controller Diagnostics",
  121.                          "15 - Get Disk Type",
  122.                          "16 - Change Disk Status",
  123.                          "17 - Set Disk Type",
  124.                          "Undefined services"};
  125. char *comm_services[] = {"00 - Initialize Serial Port",
  126.                        "01 - Send Character",
  127.                        "02 - Receive Character",
  128.                        "03 - Get Status",
  129.                        "Undefined services"};
  130. char *keyboard_services[] = {"00 - Read Character",
  131.                              "01 - Character Waiting?",
  132.                              "02 - Get Shift Status",
  133.                              "Undefined services"};
  134. char *printer_services[] = {"00 - Send Byte",
  135.                             "01 - Initialize Printer",
  136.                             "02 - Get Printer Status",
  137.                             "Undefined services"};
  138. char *dos_services[] = {"00 - Terminate",
  139.                         "01 - Keyboard Input With Echo",
  140.                         "02 - Display Output",
  141.                         "03 - Serial Input",
  142.                         "04 - Serial Output",
  143.                         "05 - Printer Output",
  144.                         "06 - Keyboard/Display I/O",
  145.                         "07 - Keyboard Input No Echo",
  146.                         "08 - Keyboard Input No Echo",
  147.                         "09 - Display String",
  148.                         "0A - Buffered Keyboard Input",
  149.                         "0B - Keyboard Status",
  150.                         "0C - Clear Keyboard",
  151.                         "0D - Reset Disk",
  152.                         "0E - Set Default Drive",
  153.                         "0F - Open File FCB Mode",
  154.                         "10 - Close File FCB Mode",
  155.                         "11 - Find First File FCB Mode",